<!-- 科研管理-项目规划--立项申请 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="所属学院">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">
            <el-col :span="6">
            <el-form-item label="课题组">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

            <el-col :span="6">
            <el-form-item label="指导老师">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

            <el-col :span="6">
            <el-form-item label="审批状态">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
                收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FBILLNO" label="单号" width="100"></el-table-column>
          <!-- <el-table-column prop="FBILLCREDATE" label="申请日期"></el-table-column> -->
          <el-table-column prop="FHOME" label="所属学院"></el-table-column>
          <el-table-column prop="FUSER" label="课题组" width="85"></el-table-column>
          <el-table-column prop="FCATNAME" label="项目名称" ></el-table-column>
          <el-table-column prop="FTEACH" label="指导老师" width="85"></el-table-column>
          <!-- <el-table-column prop="FWEEK" label="项目周期"></el-table-column> -->
          <!-- <el-table-column prop="FBEGDATE" label="预计起日" width="95"></el-table-column> -->
          <!-- <el-table-column prop="FENDDATE" label="预计讫日" width="95"></el-table-column> -->
          <el-table-column prop="FMONEY" label="预计费用"  width="85"></el-table-column>
          <el-table-column prop="FBILLSTATE" label="状态" width="85" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                编辑
              </el-button>

              <el-popconfirm title="确定删除当前申请吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-s-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>

            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '化学与材料科学学院'
        }, {
          value: '2',
          label: '生命科学学院'
        }],

        options1: [{
          value: '1',
          label: '秦始皇'
        }, {
          value: '2',
          label: '汉武帝'
        }],

        options3: [{
          value: '1',
          label: '待审批'
        }, {
          value: '2',
          label: '已审批'
        }, {
          value: '8',
          label: '已驳回'
        }],

        options4: [{
          value: '1',
          label: '化学系'
        }, {
          value: '2',
          label: '分析测试中心'
        }, {
          value: '8',
          label: '食品安全与检测'
        }],
        
        customlist:[
          {
            "FBILLNO":"",
            "FBILLCREDATE":"2024-11-03",
            "FHOME":"化学与材料科学学院",
            "FUSER":"曹操",
            "FCATNAME":"医疗垃圾智慧处理系统",
            "FTEACH":"秦始皇",
            "FWEEK":"3个月",
            "FBEGDATE":"2025-02-01",
            "FENDDATE":"2025-04-30",
            "FMONEY":"10万",
            "FBILLSTATE":"申请中"
          },
        ],
        list: [
            {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-03",
            "FHOME":"化学与材料科学学院",
            "FUSER":"曹操",
            "FCATNAME":"医疗垃圾智慧处理系统",
            "FTEACH":"秦始皇",
            "FWEEK":"3个月",
            "FBEGDATE":"2025-02-01",
            "FENDDATE":"2025-04-30",
            "FMONEY":"10万",
            "FBILLSTATE":"申请中"
            },{
            "FBILLNO": "K241130002", 
            "FBILLCREDATE":"2024-11-03",
            "FHOME":"化学与材料科学学院",
            "FUSER":"刘备",
            "FCATNAME":"血清中免疫抑制剂代谢物的拉曼芯片研制",
            "FTEACH":"汉武帝",
            "FWEEK":"3个月",
            "FBEGDATE":"2025-02-01",
            "FENDDATE":"2025-04-30",
            "FMONEY":"8万",
            "FBILLSTATE":"申请中"
            },
            ,{
            "FBILLNO": "K241130003", 
            "FBILLCREDATE":"2024-11-03",
            "FHOME":"生命科学学院",
            "FUSER":"关羽",
            "FCATNAME":"通过T-SAFE系统将无筛选标记的DNA片段输送到水稻基因组",
            "FTEACH":"唐太宗",
            "FWEEK":"5个月",
            "FBEGDATE":"2025-02-01",
            "FENDDATE":"2025-06-30",
            "FMONEY":"112万",
            "FBILLSTATE":"申请中"
            },{
            "FBILLNO": "K241130005", 
            "FBILLCREDATE":"2024-11-03",
            "FHOME":"生命科学学院",
            "FUSER":"孙权",
            "FCATNAME":"水稻种子性状测量综合性平台",
            "FTEACH":"宋太祖",
            "FWEEK":"6个月",
            "FBEGDATE":"2025-02-01",
            "FENDDATE":"2025-07-31",
            "FMONEY":"15万",
            "FBILLSTATE":"申请中"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>